<?php

namespace module\app\validate;

use app\Validate;

class Me extends Validate
{
    /**
     * 验证场景.
     *
     * @var array<array<string>>
     */
    protected $scene = [
        'update' => ['nickname', 'birthday', 'career', 'gender', 'area_id', 'aim', 'hobby'],  // 密码登录
        'reset' => ['origin', 'password', 'password_confirm'],  // 密码登录
    ];
    /**
     * 验证规则.
     *
     * @var array<string>
     */
    protected $rule = [
        'origin'  => 'require|min:6|max:16',  // 密码
        'password'  => 'require|min:6|max:16',  // 密码
        'password_confirm' => 'require|confirm:password',  // 确认密码
        'mobile'  => 'require|min:6|max:16',  // 手机号
        'avatar'  => 'require|min:6|max:16',  // 头像
        'step'  => 'in:1,2,3',  // 第几步
        'nickname'  => 'requireIf:step,1|min:6|max:16',  // 昵称
        'birthday'  => 'requireIf:step,1|date|length:10',  // 生日
        'career'  => 'requireIf:step,1|date|length:10',  // 职业
        'gender'  => 'requireIf:step,2|min:6|max:16',  // 性别
        'aim'  => 'requireIf:step,2|min:6|max:16',  // 交友目的
        'hobby'  => 'requireIf:step,3|min:6|max:16',  // 兴趣
    ];
    /**
     * 验证字段描述
     * 
     * @var array<string>
     */
    protected $field = [
        'origin' => '原始密码',
        'password' => '新密码',
        'password_confirm' => '确认密码',
        'mobile'  => '手机号',
        'avatar'  => '头像',  // 
        'nickname'  => '昵称',  // 
        'birthday'  => '生日',  // 
        'career'  => '职业',  // 
        'gender'  => '性别',  // 
        'aim'  => '交友目的',  // 
        'hobby'  => '兴趣',  // 
    ];
}